package com.lcj;

import com.geccocrawler.gecco.GeccoEngine;
import com.geccocrawler.gecco.request.HttpGetRequest;
import com.geccocrawler.gecco.spring.SpringGeccoEngine;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@SpringBootApplication
@Configuration
public class Zzz4JobApplication {
    @Bean
    public SpringGeccoEngine initGecco() {
        return new SpringGeccoEngine() {
            @Override
            public void init() {
//                HttpGetRequest start = new HttpGetRequest("http://job.hnw.net/jobs/jobs-list.php");
                HttpGetRequest start = new HttpGetRequest("http://www.cshr.com.cn/csrcwhr/Person/searchResult.aspx");
                start.setCharset("UTF-8");
                start.addHeader("Cookie","UM_distinctid=165d22de3f40-0431fa2cb2c7de-47e1039-100200-165d22de3f64a6; ASP.NET_SessionId=zyl0gkgibrz4vvf4ubldpkcn; Hm_lvt_4812a2c52be6550590aa88bfce3f9f4b=1536829548,1536898765; CNZZDATA4917286=cnzz_eid%3D1734352957-1536824744-%26ntime%3D1536902800; Hm_lpvt_4812a2c52be6550590aa88bfce3f9f4b=1536907608");
                start.addHeader("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36");
                GeccoEngine.create()
                        .pipelineFactory(springPipelineFactory)
                        .classpath("com.lcj")
                        .start(start)
                        .interval(3000)
                        .debug(false    )
                        .start();
            }
        };
    }

    public static void main(String[] args) throws Exception {
        SpringApplication.run(Zzz4JobApplication.class, args);
    }
}
